<!DOCTYPE html>
<html>
<head>
    <title>采购报销</title>
    <#include "/header.html">
    <!-- 图片预览 -->
    <link rel="stylesheet" href="${request.contextPath}/statics/plugins/viewer/viewer.min.css">
    <script src="${request.contextPath}/statics/plugins/viewer/viewer.min.js"></script>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn" style="font-size: 12px">
            <form class="form-inline" role="form">
                <a class="btn btn-default btn-sm" @click="reset"><i class="fa fa-refresh"></i></a>
                <div class="form-group">
                    <input type="text" class="form-control input-sm" v-model.trim="q.applyNo" @keyup.enter="query" placeholder="单据号">
                </div>&nbsp;&nbsp;&nbsp;
                <div class="form-group">
                    <input class="form-control input-sm" v-model="q.beginCreatetime" style="width: 120px;" @keyup.enter="query" @click = "checkBeginDate" placeholder="入库开始时间"/>
                    至
                    <input class="form-control input-sm" v-model="q.endCreatetime" style="width: 120px;"@keyup.enter="query" @click = "checkEndDate" placeholder="入库结束时间"/>
                </div>&nbsp;&nbsp;&nbsp;
                <div class="form-group">
                    <el-select v-model="purchaseApplyForm.storePurchaseApplyEntity.financeStatus" placeholder="财务审核状态" size="mini">
                        <el-option  v-for="item in e.purchaseApplyFinanceStatusList"
                                    :key="item.value"  :label="item.label" :value="item.value">  </el-option>
                    </el-select>
                </div>&nbsp;&nbsp;&nbsp;
                <div class="form-group">
                        <el-select v-model="purchaseApplyForm.storePurchaseApplyEntity.tax" placeholder="是否含税" size="mini">
                            <el-option
                                    v-for="item in e.purchaseApplyTaxList"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                </div>&nbsp;&nbsp;&nbsp;
                <a class="btn btn-default btn-sm"  @click="query"><i class="fa fa-search"></i>&nbsp;查询</a>

                <a class="btn btn-default btn-sm"  @click="BatchAudit"><i class="fa fa-search"></i>批量审核</a>

                <a class="btn btn-default btn-sm"  @click="BulkPayment"><i class="fa fa-search"></i>批量付款</a>


            </form>
        </div>
        <div>
            <el-table ref="ReimbursementTable" :data="page.tableData"  border  style="width: 100%" size="mini" @selection-change="selectChange">
                <el-table-column  type="selection"  width="40"> </el-table-column>
                <el-table-column prop="" label="操作" width="180" align="center">
                    <template slot-scope="scope">
                        <el-button size="mini" v-if="scope.row.financeStatus == 2 " @click="auditAgainCheck(scope.$index, scope.row)">复审</el-button>
                        <el-button size="mini" v-if="scope.row.financeStatus == 0 " @click="audit(scope.$index, scope.row)">审核</el-button>
                        <el-button size="mini" v-if="scope.row.financeStatus == 1 " @click="back(scope.$index, scope.row)">弃审</el-button>
                        <el-button size="mini" v-if="scope.row.financeStatus == 1 " @click="OnePay(scope.$index, scope.row)">付款</el-button>
                        <el-button size="mini" @click="examine(scope.$index, scope.row)">查看</el-button>
                    </template>
                </el-table-column>
                <el-table-column prop="applyId" label="单据ID" min-width="60" align="center" style="display: inline"> </el-table-column>
                <el-table-column prop="applyNo" label="单据号" min-width="100" align="center"> </el-table-column>
                <el-table-column prop="totalMoney" label="总金额" min-width="70"  align="center"> </el-table-column>
                <el-table-column prop="tax" min-width="70" label="含税状态" :formatter="formatTax" align="center"></el-table-column>
                <el-table-column prop="sellerName" label="申请门店名称" min-width="70" align="center"></el-table-column>
                <el-table-column prop="status" label="申请单状态" :formatter="formatPurchaseApplyStatus" min-width="70" align="center"></el-table-column>
                <el-table-column prop="applyRemark" label="采购备注" min-width="70" align="center"> </el-table-column>
                <el-table-column prop="auditRemark" label="审核备注" min-width="70" align="center"> </el-table-column>
                <el-table-column prop="purchaseType" label="采购类型" :formatter="formatPurchase" min-width="70" align="center"></el-table-column>
                <el-table-column prop="receiveName" label="入库人" min-width="60"  align="center"> </el-table-column>
                <el-table-column prop="receiveTime" label="入库时间" min-width="100"  align="center"> </el-table-column>
                <el-table-column prop="checkName" label="审核人" min-width="100"  align="center"> </el-table-column>
                <el-table-column prop="checkTime" label="审核时间" align="center"> </el-table-column>
                <el-table-column prop="financeRemark" label="付款备注" align="center"> </el-table-column>
                <el-table-column prop="financeStatus" label="财务审核状态" :formatter="formatStatus" align="center"> </el-table-column>
                <el-table-column prop="createName" label="申请人" align="center"> </el-table-column>
                <el-table-column prop="createTime" label="创建时间"min-width="150"align="center"> </el-table-column>
            </el-table>
            <div class="block text-right">
                <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="1"
                        :page-sizes="[page.pageSize, 2*page.pageSize, 4*page.pageSize]"
                        :page-size="page.pageSize"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="page.totalCount">
                </el-pagination>
            </div>
        </div>
    </div>
    <div v-show="!showList">
        <el-row v-if="purchaseRow != null" class="text-center">
            <el-button size="mini" v-if="purchaseRow.financeStatus == 2 " @click="auditAgainCheckTwo()">复审</el-button>
            <el-button size="mini" v-if="purchaseRow.financeStatus == 0 " @click="auditTwo()">审核</el-button>
            <el-button size="mini" v-if="purchaseRow.financeStatus == 1 " @click="backTwo()">弃审</el-button>
            <el-button size="mini" v-if="purchaseRow.financeStatus == 1 " @click="OnePayTwo()">付款</el-button>
            <el-button size="mini" @click="getBack()">返回</el-button>
        </el-row>
        <el-row v-if="JSON.stringify(storeMaterialInAndDetailList) != '[]'">
            <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>采购单实际入库详情</span>
                </div>
                <div class="text item">
                    <div class="row" style="line-height:30px;font-size: 12px;">
                        <div class="col-md-2">
                            <div class="col-md-6 text-right">采购单号：</div>
                            <div class="col-md-6">{{storeMaterialInAndDetailList[0].inNo}}</div>
                        </div>
                        <div class="col-md-2">
                            <div class="col-md-5 text-right">仓库名称 ：</div>
                            <div class="col-md-7">{{storeMaterialInAndDetailList[0].stockName}}</div>
                        </div>
                        <div class="col-md-2">
                            <div class="col-md-5 text-right">采购单总金额 ：</div>
                            <div class="col-md-7">{{storePurchaseApplyEntity.totalMoney}}</div>
                        </div>
                        <div class="col-md-2">
                            <div class="col-md-5 text-right">财务付款时间 ：</div>
                            <div class="col-md-7">{{storePurchaseApplyEntity.financePaytime}}</div>
                        </div>
                    </div>
                </div>
            </el-card>
        </el-row>
        <div v-for="(storeMaterialInAndDetail,index) in storeMaterialInAndDetailList">
            <el-row>
                <el-card class="box-card">
                    <div slot="header" class="clearfix">
                        <span>第{{index+1}}次入库</span>
                    </div>
                    <div class="text item">
                        <div class="row" style="line-height:30px;font-size: 12px;">
                            <div class="col-md-2">
                                <div class="col-md-6 text-right">入库人 ：</div>
                                <div class="col-md-6">{{storeMaterialInAndDetail.createName}}</div>
                            </div>
                            <div class="col-md-2">
                                <div class="col-md-5 text-right">入库时间 ：</div>
                                <div class="col-md-7">{{storeMaterialInAndDetail.createTime}}</div>
                            </div>
                            <div class="col-md-2">
                                <div class="col-md-6 text-right">审核人 ：</div>
                                <div class="col-md-6">{{storeMaterialInAndDetail.checkName}}</div>
                            </div>
                            <div class="col-md-2">
                                <div class="col-md-5 text-right">审核时间 ：</div>
                                <div class="col-md-7">{{storeMaterialInAndDetail.checkTime}}</div>
                            </div>
                            <div class="col-md-2">
                                <div class="col-md-6 text-right">入库备注 ：</div>
                                <div class="col-md-6">{{storeMaterialInAndDetail.remark}}</div>
                            </div>
                            <div class="col-md-2">
                                <div class="col-md-6 text-right">入库单据 ：</div>
                                <div class="col-md-6">
                                    <!--{{storeMaterialInAndDetail.purchaseImages}}<button @click="view(storeMaterialInAndDetail.otherAccessoryList)">查看</button>-->
                                    <el-button size="mini" @click="view(storeMaterialInAndDetail.otherAccessoryList)">查 看</el-button>
                                </div>
                            </div>
                        </div>
                    </div>
                </el-card>
            </el-row>
            <el-row>
                <el-card class="box-card">
                    <div class="text item">
                        <el-form ref="form" :model="storeMaterialInAndDetail" label-width="80px" size="mini">
                            <el-table border stripe ref="multipleTable" :data="storeMaterialInAndDetail.storeMaterialInDetailEntityList" style="margin-bottom: 20px;"
                                      tooltip-effect="dark" size="mini">
                                <el-table-column type="index" width="60" label="序号" align="center"> </el-table-column>
                                <el-table-column prop="materialId" label="耗材ID" width="80" align="center"></el-table-column>
                                <el-table-column prop="materialName" label="耗材名称" align="center" show-overflow-tooltip></el-table-column>
                                <el-table-column prop="specifications" label="规格" width="200" align="center"></el-table-column>
                                <el-table-column prop="materialModel" label="型号" width="200" align="center"></el-table-column>
                                <el-table-column prop="showUnit" label="暂时单位" width="100"  align="center"></el-table-column>
                                <el-table-column prop="materialQuantity" label="数量" width="100" align="center"></el-table-column>
                                <el-table-column prop="length" label="长" width="100" align="center"></el-table-column>
                                <el-table-column prop="width" label="宽" width="100" align="center"></el-table-column>
                                <el-table-column prop="weight" label="克重" width="100" align="center"></el-table-column>
                                <el-table-column prop="unitMoney" label="单价" width="100" align="center"></el-table-column>
                                <el-table-column prop="totalMoney" label="总价" width="200" align="center"> </el-table-column>
                                <el-table-column prop="remark" label="明细入库备注" width="200" align="center"> </el-table-column>
                            </el-table>
                        </el-form>
                    </div>
                </el-card>
            </el-row>
        </div>
    </div>
    <!-- 入库单据浏览上传弹窗 -->
    <el-dialog id="view" title="提示" :visible.sync="otherAccessoryDialog"  width="75%" >
        <el-table :data="otherAccessoryList" border>
            <el-table-column type="index" label="序号" width="50" header-align="center" align="center"></el-table-column>
            <el-table-column property="name" label="图片名" width="350"></el-table-column>
            <el-table-column label="图片(点击可预览)" align="center" width="120">
                <template  slot-scope="scope">
                    <img :src="window.parent.vm.ossHost+scope.row.imageUrl" style="width: 100px">
                </template>
            </el-table-column>
            <el-table-column property="createTime" label="创建时间"></el-table-column>
        </el-table>
    </el-dialog>

</div>
<script src="${request.contextPath}/statics/js/modules/purchase/Reimbursement.js?_${.now?long}"></script>
</body>
</html>